import re

type_map_dict = {
    'libc::c_char': 'i8',
    'libc::c_long': 'i64',
    'libc::c_uchar': 'u8',
    'libc::c_ulong': 'u64',
    'libc::c_short': 'i16',
    'libc::c_void': '()',
    'libc::c_ushort': 'u16',
    'libc::c_longlong': 'i64',
    'libc::c_int': 'i32',
    'libc::c_ulonglong': 'u64',
    'libc::c_uint': 'u32',
    'libc::c_schar': 'i8',
}

count = 0

def get_type_def_summary():
    return {"已优化的libc类型": count}

def manage_type_def(content):

    global count

    for key, value in type_map_dict.items():
        count += content.count(key)
        content = content.replace(key, value)
    content = content.replace('use :: libc;\n', '\n')
    return content

